/*
 * @Author: Wanko
 * @Date: 2024-06-16 10:13:16
 * @LastEditors: Wanko
 * @LastEditTime: 2024-06-16 11:36:38
 * @Description: 
 */
const stringSimilarity = require('string-similarity')

function isSimilarCard(origin, target, threshold=0.8) {
  console.log(origin, target)
  const existingTokens = origin.split('')
  const newTokens = target.split('')

  const similarity = stringSimilarity.compareTwoStrings(existingTokens.join(''), newTokens.join(''))

  return similarity >= threshold
}

module.exports = {
  isSimilarCard
}